<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0">
    <title>分享云微商城</title>

    <!-- css -->
    <link href="/mall/Public/Resource/css/bootstrap.min.css" rel="stylesheet">
    <link href="/mall/Public/Resource/css/all.css" rel="stylesheet">
    <script type="text/javascript" src="//libs.baidu.com/jquery/1.9.1/jquery.min.js"></script>
    <script type="text/javascript" src="/mall/Public/Resource/js/common.js"></script>
    <script language='javascript' src='/mall/Public/Resource/js/jquery.cookie.js'></script>
    <script language='javascript' src='/mall/Public/Resource/js/wechat-useragent.js'></script>
</head>
<body>
<div class="navbar-default" role="navigation">
    <div class="container-fluid">
        <ul class="nav">
            <li><a href="/mall/Public/index.php">微商场</a></li>
            <li><a href="/mall/Public/index.php/shoppingcart/index">购物车</a></li>
            <li><a href="/mall/Public/index.php/index/about">分享云简介</a></li>
        </ul>
    </div>
</div>



<div class="main">
    <div class="container-fluid">
        <div class="row">
            <div class="col-xs-12 order-list address">
                <p>请填写收货地址</p>
                <div class="order">
                    <span>收货人</span><input id="username" type="text">
                </div>
                <div class="order">
                    <span>手机号</span><input id="userphone" maxlength="11" type="text" onkeyup="value=this.value.replace(/\D+/g,'')">
                </div>
                <div class="order">
                    <span>收货地址</span><input id="address" type="text">
                </div>
            </div>
        </div>
    </div>
    <div class="footer">
        <ul class="nav nav-half">
            <li class="my-cart"><a href="/mall/Public/index.php/order/index">取消</a></li>
            <li class="btn-red"><a href="#" onclick="save()">保存</a></li>
        </ul>
    </div>

    <script type="text/javascript">
        var address = $.cookie('lockshop_address');
        if(!isOwnEmpty(address) && typeof address != undefined){
            document.getElementById('address').value = address;
            document.getElementById('userphone').value = $.cookie('lockshop_userphone');
            document.getElementById('username').value = $.cookie('lockshop_username');

        }

        function save() {

            var address = document.getElementById('address').value;
            var userphone = document.getElementById('userphone').value;
            var username = document.getElementById('username').value;

            if(isOwnEmpty(address) || isOwnEmpty(userphone) || isOwnEmpty(username)){
                alert("请填写完整信息后保存");
                return;
            }
            if(!validatemobile(userphone)){
                return;
            }


            var r=confirm("手机号将用于查询您的订单,请确认无误"+userphone);
            if (r==false)
            {
                return;
            }


            $.cookie('lockshop_address',address,{ expires: 7, path: '/' });
            $.cookie('lockshop_userphone',userphone,{ expires: 7, path: '/' });
            $.cookie('lockshop_username',username,{ expires: 7, path: '/' });

             window.location = '/mall/Public/index.php/order/index';

        }
    </script>


</div>

</body>
</html>